<?php

class logout_handler extends _site_handler {
	public $BackLink = '';
	public $ShowNav = FALSE;

	public function __construct($m, $view) {
		$this->InitializeSite($m);
		$_SESSION['gcmsusername'] = NULL;
		header("Location: " . (($_GET['backlink'])?$_GET['backlink']:'/'));
		exit;
	}

	// TODO: allow for overriding variables
	public static function InitializePage($m, $view) {
		_site::$Secured = FALSE;
		// TODO: Site back link?
		self::$view->BackLink = Monkake::Get('site_url', NULL, TRUE);
		if ( @$_GET['backlink'] ) self::$view->BackLink = $_GET['backlink'];
		session_destroy();
		_site::InitializeSite();
	}
}